load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_benchmark", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "field_path",
    srcs = [
        "field_path.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:server_base",
        "//src/mongo/db:server_options",
        "//src/mongo/db/query:query_knobs",
    ],
)

mongo_cc_library(
    name = "document_path_support",
    srcs = [
        "document_path_support.cpp",
    ],
    deps = [
        "//src/mongo/db:common",
        "//src/mongo/db/exec/document_value",
    ],
)

mongo_cc_library(
    name = "change_stream_test_helpers",
    srcs = [
        "change_stream_test_helpers.cpp",
    ],
    deps = [
        ":change_stream_pipeline",
    ],
)

idl_generator(
    name = "change_stream_pre_and_post_images_options_gen",
    src = "change_stream_pre_and_post_images_options.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "storage_stats_spec_gen",
    src = "storage_stats_spec.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "legacy_runtime_constants_gen",
    src = "legacy_runtime_constants.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_change_stream_gen",
    src = "document_source_change_stream.idl",
    deps = [
        ":resume_token_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "resume_token_gen",
    src = "resume_token.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

mongo_cc_library(
    name = "document_sources_idl",
    srcs = [
        "document_source_change_stream_gen",
        "document_source_current_op_gen",
        "document_source_densify_gen",
        "document_source_fill_gen",
        "document_source_hybrid_scoring_input_util.cpp",
        "document_source_internal_apply_oplog_update_gen",
        "document_source_internal_projection_gen",
        "document_source_list_mql_entities_gen",
        "document_source_list_sampled_queries_gen",
        "document_source_list_sessions_gen",
        "document_source_lookup_gen",
        "document_source_merge_gen",
        "document_source_merge_modes_gen",
        "document_source_merge_spec.cpp",
        "document_source_out_gen",
        "document_source_parsing_validators.cpp",
        "document_source_query_settings_gen",
        "document_source_query_stats_gen",
        "document_source_query_stats_validators.cpp",
        "document_source_rank_fusion_gen",
        "document_source_rank_fusion_inputs_gen",
        "document_source_replace_root_gen",
        "document_source_score_fusion_gen",
        "document_source_score_fusion_inputs_gen",
        "document_source_score_gen",
        "document_source_set_variable_from_subpipeline_gen",
        "document_source_set_window_fields_gen",
        "document_source_union_with_gen",
        "exchange_spec_gen",
        "resume_token.cpp",
        "resume_token_gen",
        "storage_stats_spec_gen",
        "//src/mongo/db/pipeline:document_source_coll_stats_gen",
        "//src/mongo/db/pipeline:document_source_internal_all_collection_stats_gen",
        "//src/mongo/db/pipeline:document_source_list_cluster_catalog_gen",
        "//src/mongo/db/pipeline/search:document_source_internal_search_id_lookup_gen",
        "//src/mongo/db/pipeline/search:document_source_list_search_indexes_gen",
        "//src/mongo/db/pipeline/search:document_source_list_search_indexes_validator.cpp",
        "//src/mongo/db/pipeline/search:plan_sharded_search_gen",
    ],
    deps = [
        ":docs_needed_bounds",
        ":runtime_constants_idl",
        ":value_idl",
        "//src/mongo:base",
        "//src/mongo/db:namespace_spec",
        "//src/mongo/db/auth:security_token_auth",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/query/query_shape",
        "//src/mongo/db/query/query_stats:query_stats_parse",
        "//src/mongo/db/repl:local_oplog_info",
        "//src/mongo/db/storage/key_string",
        "//src/mongo/db/timeseries:timeseries_options",
        "//src/mongo/idl:idl_parser",
        "//src/mongo/s:common_s",
        "//src/mongo/util:pcre_util",
    ],
)

mongo_cc_library(
    name = "change_stream_helpers",
    srcs = [
        "change_stream_helpers.cpp",
    ],
    deps = [
        "document_sources_idl",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:shard_role_api",
        "//src/mongo/db/repl:oplog_entry",
    ],
)

mongo_cc_library(
    name = "change_stream_topology_helpers",
    srcs = [
        "change_stream_topology_helpers.cpp",
    ],
    deps = [
        "//src/mongo/db:server_base",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/pipeline:sharded_agg_helpers",
    ],
)

idl_generator(
    name = "value_gen",
    src = "value.idl",
)

mongo_cc_library(
    name = "value_idl",
    srcs = [
        "value_gen",
    ],
    deps = [
        "//src/mongo/db/exec/document_value",
        "//src/mongo/idl:idl_parser",
    ],
)

idl_generator(
    name = "change_stream_preimage_gen",
    src = "change_stream_preimage.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "aggregate_command_gen",
    src = "aggregate_command.idl",
    deps = [
        ":exchange_spec_gen",
        ":external_data_source_option_gen",
        ":legacy_runtime_constants_gen",
        "//src/mongo/crypto:fle_field_schema_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db:write_concern_options_gen",
        "//src/mongo/db/auth:access_checks_gen",
        "//src/mongo/db/auth:action_type_gen",
        "//src/mongo/db/query:hint_gen",
        "//src/mongo/db/query/client_cursor:cursor_response_gen",
        "//src/mongo/db/query/query_settings:query_settings_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "external_data_source_option_gen",
    src = "external_data_source_option.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "name_expression_gen",
    src = "name_expression.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

mongo_cc_library(
    name = "aggregation_request_helper",
    srcs = [
        "aggregation_request_helper.cpp",
        "name_expression_parser.cpp",
        "query_request_conversion.cpp",
        ":aggregate_command_gen",
        ":external_data_source_option_gen",
        ":name_expression_gen",
    ],
    deps = [
        ":document_sources_idl",
        "//src/mongo/db:server_base",
        "//src/mongo/db/auth:security_token",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/query:command_request_response",
        "//src/mongo/db/query:common_query_enums_and_helpers",
        "//src/mongo/db/query:query_request",
        "//src/mongo/db/query/query_settings",
        "//src/mongo/db/repl:read_concern_args",
        "//src/mongo/db/storage:storage_options",
    ],
)

mongo_cc_library(
    name = "aggregation",
    srcs = [
        "aggregation.cpp",
    ],
    deps = [
        ":aggregation_request_helper",
        ":pipeline",
        "//src/mongo/db:query_expressions",
    ],
)

idl_generator(
    name = "accumulator_percentile_gen",
    src = "accumulator_percentile.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "accumulator_percentile_enum_gen",
    src = "accumulator_percentile_enum.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "map_reduce_options_gen",
    src = "map_reduce_options.idl",
)

mongo_cc_library(
    name = "accumulator",
    srcs = [
        "accumulation_statement.cpp",
        "accumulator_add_to_set.cpp",
        "accumulator_avg.cpp",
        "accumulator_concat_arrays.cpp",
        "accumulator_covariance.cpp",
        "accumulator_exp_moving_avg.cpp",
        "accumulator_first.cpp",
        "accumulator_for_bucket_auto.cpp",
        "accumulator_integral.cpp",
        "accumulator_js_reduce.cpp",
        "accumulator_last.cpp",
        "accumulator_locf.cpp",
        "accumulator_merge_objects.cpp",
        "accumulator_min_max.cpp",
        "accumulator_multi.cpp",
        "accumulator_percentile.cpp",
        "accumulator_push.cpp",
        "accumulator_rank.cpp",
        "accumulator_set_union.cpp",
        "accumulator_std_dev.cpp",
        "accumulator_sum.cpp",
        "percentile_algo_accurate.cpp",
        "percentile_algo_continuous.cpp",
        "percentile_algo_discrete.cpp",
        "percentile_algo_tdigest.cpp",
        "percentile_algo_tdigest_distributed.cpp",
        ":accumulator_percentile_enum_gen",
        ":accumulator_percentile_gen",
        ":map_reduce_options_gen",
        "//src/mongo/db/pipeline/window_function:window_bounds.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_count.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_covariance.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_expression.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_expression_gen",
        "//src/mongo/db/pipeline/window_function:window_function_integral.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_min_max_scaler_util.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_percentile.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_shift.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_sum.cpp",
    ],
    deps = [
        ":field_path",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db/exec:sort_executor",
        "//src/mongo/db/index:index_access_method",
        "//src/mongo/db/query/compiler/logical_model/sort_pattern",
        "//src/mongo/db/sorter:sorter_base",
    ],
)

mongo_cc_library(
    name = "granularity_rounder",
    srcs = [
        "granularity_rounder.cpp",
        "granularity_rounder_powers_of_two.cpp",
        "granularity_rounder_preferred_numbers.cpp",
    ],
    deps = [
        ":field_path",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db/exec/document_value",
    ],
)

mongo_cc_library(
    name = "pipeline",
    srcs = [
        "accumulator_internal_construct_stats.cpp",
        "document_source.cpp",
        "document_source_add_fields.cpp",
        "document_source_bucket.cpp",
        "document_source_bucket_auto.cpp",
        "document_source_count.cpp",
        "document_source_current_op.cpp",
        "document_source_densify.cpp",
        "document_source_documents.cpp",
        "document_source_exchange.cpp",
        "document_source_facet.cpp",
        "document_source_fill.cpp",
        "document_source_find_and_modify_image_lookup.cpp",
        "document_source_geo_near.cpp",
        "document_source_graph_lookup.cpp",
        "document_source_group.cpp",
        "document_source_group_base.cpp",
        "document_source_hybrid_scoring_util.cpp",
        "document_source_index_stats.cpp",
        "document_source_internal_compute_geo_near_distance.cpp",
        "document_source_internal_convert_bucket_index_stats.cpp",
        "document_source_internal_inhibit_optimization.cpp",
        "document_source_internal_projection.cpp",
        "document_source_internal_replace_root.cpp",
        "document_source_internal_shardserver_info.cpp",
        "document_source_internal_shred_documents.cpp",
        "document_source_internal_split_pipeline.cpp",
        "document_source_internal_unpack_bucket.cpp",
        "document_source_limit.cpp",
        "document_source_list_cached_and_active_users.cpp",
        "document_source_list_local_sessions.cpp",
        "document_source_list_mql_entities.cpp",
        "document_source_list_sampled_queries.cpp",
        "document_source_list_sessions.cpp",
        "document_source_lookup.cpp",
        "document_source_match.cpp",
        "document_source_merge.cpp",
        "document_source_out.cpp",
        "document_source_plan_cache_stats.cpp",
        "document_source_project.cpp",
        "document_source_query_stats.cpp",
        "document_source_queue.cpp",
        "document_source_rank_fusion.cpp",
        "document_source_redact.cpp",
        "document_source_replace_root.cpp",
        "document_source_sample.cpp",
        "document_source_sample_from_random_cursor.cpp",
        "document_source_score.cpp",
        "document_source_score_fusion.cpp",
        "document_source_sequential_document_cache.cpp",
        "document_source_set_metadata.cpp",
        "document_source_set_variable_from_subpipeline.cpp",
        "document_source_set_window_fields.cpp",
        "document_source_single_document_transformation.cpp",
        "document_source_skip.cpp",
        "document_source_sort.cpp",
        "document_source_sort_by_count.cpp",
        "document_source_streaming_group.cpp",
        "document_source_tee_consumer.cpp",
        "document_source_union_with.cpp",
        "document_source_unwind.cpp",
        "explain_util.cpp",
        "group_from_first_document_transformation.cpp",
        "group_processor.cpp",
        "group_processor_base.cpp",
        "hybrid_search_pipeline_builder.cpp",
        "match_processor.cpp",
        "merge_processor.cpp",
        "pipeline.cpp",
        "pipeline_factory.cpp",
        "pipeline_test_util.cpp",
        "rank_fusion_pipeline_builder.cpp",
        "redact_processor.cpp",
        "score_fusion_pipeline_builder.cpp",
        "semantic_analysis.cpp",
        "sequential_document_cache.cpp",
        "single_document_transformation_processor.cpp",
        "skip_and_limit.cpp",
        "sort_reorder_helpers.cpp",
        "stage_params_to_document_source_registry.cpp",
        "tee_buffer.cpp",
        "writer_util.cpp",
        "//src/mongo/db/exec/agg:bucket_auto_stage.cpp",
        "//src/mongo/db/exec/agg:coll_stats_stage.cpp",
        "//src/mongo/db/exec/agg:current_op_stage.cpp",
        "//src/mongo/db/exec/agg:densify_stage.cpp",
        "//src/mongo/db/exec/agg:document_source_to_stage_registry.cpp",
        "//src/mongo/db/exec/agg:exchange_stage.cpp",
        "//src/mongo/db/exec/agg:exec_pipeline.cpp",
        "//src/mongo/db/exec/agg:facet_stage.cpp",
        "//src/mongo/db/exec/agg:find_and_modify_image_lookup_stage.cpp",
        "//src/mongo/db/exec/agg:graph_lookup_stage.cpp",
        "//src/mongo/db/exec/agg:group_base_stage.cpp",
        "//src/mongo/db/exec/agg:group_stage.cpp",
        "//src/mongo/db/exec/agg:internal_all_collection_stats_stage.cpp",
        "//src/mongo/db/exec/agg:internal_compute_geo_near_distance_stage.cpp",
        "//src/mongo/db/exec/agg:internal_convert_bucket_index_stats_stage.cpp",
        "//src/mongo/db/exec/agg:internal_inhibit_optimization_stage.cpp",
        "//src/mongo/db/exec/agg:internal_list_collections_stage.cpp",
        "//src/mongo/db/exec/agg:internal_set_window_fields_stage.cpp",
        "//src/mongo/db/exec/agg:internal_shard_server_info_stage.cpp",
        "//src/mongo/db/exec/agg:internal_shred_documents_stage.cpp",
        "//src/mongo/db/exec/agg:internal_split_pipeline_stage.cpp",
        "//src/mongo/db/exec/agg:internal_unpack_bucket_stage.cpp",
        "//src/mongo/db/exec/agg:limit_stage.cpp",
        "//src/mongo/db/exec/agg:list_catalog_stage.cpp",
        "//src/mongo/db/exec/agg:list_local_sessions_stage.cpp",
        "//src/mongo/db/exec/agg:list_mql_entities_stage.cpp",
        "//src/mongo/db/exec/agg:list_sampled_queries_stage.cpp",
        "//src/mongo/db/exec/agg:lookup_stage.cpp",
        "//src/mongo/db/exec/agg:match_stage.cpp",
        "//src/mongo/db/exec/agg:merge_stage.cpp",
        "//src/mongo/db/exec/agg:out_stage.cpp",
        "//src/mongo/db/exec/agg:pipeline_builder.cpp",
        "//src/mongo/db/exec/agg:plan_cache_stats_stage.cpp",
        "//src/mongo/db/exec/agg:query_stats_stage.cpp",
        "//src/mongo/db/exec/agg:queue_stage.cpp",
        "//src/mongo/db/exec/agg:redact_stage.cpp",
        "//src/mongo/db/exec/agg:sample_from_random_cursor_stage.cpp",
        "//src/mongo/db/exec/agg:sample_stage.cpp",
        "//src/mongo/db/exec/agg:sequential_document_cache_stage.cpp",
        "//src/mongo/db/exec/agg:set_variable_from_subpipeline_stage.cpp",
        "//src/mongo/db/exec/agg:single_document_transformation_stage.cpp",
        "//src/mongo/db/exec/agg:skip_stage.cpp",
        "//src/mongo/db/exec/agg:sort_stage.cpp",
        "//src/mongo/db/exec/agg:stage.cpp",
        "//src/mongo/db/exec/agg:streaming_group_stage.cpp",
        "//src/mongo/db/exec/agg:tee_consumer_stage.cpp",
        "//src/mongo/db/exec/agg:union_with_stage.cpp",
        "//src/mongo/db/exec/agg:unwind_processor.cpp",
        "//src/mongo/db/exec/agg:unwind_stage.cpp",
        "//src/mongo/db/exec/agg/search:internal_search_id_lookup_stage.cpp",
        "//src/mongo/db/exec/agg/search:internal_search_mongot_remote_stage.cpp",
        "//src/mongo/db/exec/agg/search:list_search_indexes_stage.cpp",
        "//src/mongo/db/exec/agg/search:search_meta_stage.cpp",
        "//src/mongo/db/exec/agg/search:vector_search_stage.cpp",
        "//src/mongo/db/pipeline:document_source_coll_stats.cpp",
        "//src/mongo/db/pipeline:document_source_internal_all_collection_stats.cpp",
        "//src/mongo/db/pipeline:document_source_internal_list_collections.cpp",
        "//src/mongo/db/pipeline:document_source_list_catalog.cpp",
        "//src/mongo/db/pipeline:document_source_list_cluster_catalog.cpp",
        "//src/mongo/db/pipeline:document_source_sharded_data_distribution.cpp",
        "//src/mongo/db/pipeline/optimization:optimize.cpp",
        "//src/mongo/db/pipeline/optimization:rule_based_rewriter.cpp",
        "//src/mongo/db/pipeline/search:document_source_internal_search_id_lookup.cpp",
        "//src/mongo/db/pipeline/search:document_source_internal_search_mongot_remote.cpp",
        "//src/mongo/db/pipeline/search:document_source_list_search_indexes.cpp",
        "//src/mongo/db/pipeline/search:document_source_search.cpp",
        "//src/mongo/db/pipeline/search:document_source_search_meta.cpp",
        "//src/mongo/db/pipeline/search:document_source_vector_search.cpp",
        "//src/mongo/db/pipeline/search:search_helper.cpp",
        "//src/mongo/db/pipeline/search:vector_search_helper.cpp",
        "//src/mongo/db/pipeline/window_function:partition_iterator.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_derivative.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_linear_fill.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_removable_document.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_removable_range.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_statement.cpp",
        "//src/mongo/db/query/query_shape:agg_cmd_shape.cpp",
        "//src/mongo/db/query/query_stats:agg_key.cpp",
        "//src/mongo/db/query/search:search_index_view_validation.cpp",
        "//src/mongo/db/query/timeseries:timeseries_translation.cpp",
    ],
    deps = [
        ":accumulator",
        ":change_stream_error_extra_info",
        ":change_stream_helpers",
        ":document_path_support",
        ":document_sources_idl",
        ":granularity_rounder",
        ":lite_parsed_document_source",
        "//src/mongo/bson/dotted_path:dotted_path_support",
        "//src/mongo/client:clientdriver_minimal",
        "//src/mongo/db:curop_failpoint_helpers",
        "//src/mongo/db:dbdirectclient",
        "//src/mongo/db:expression_context_builder",
        "//src/mongo/db:mongohasher",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:query_matcher",
        "//src/mongo/db:service_context",
        "//src/mongo/db:shard_filterer",
        "//src/mongo/db:shard_role_api",
        "//src/mongo/db/auth",
        "//src/mongo/db/commands:mongod_fsync",
        "//src/mongo/db/commands:test_commands_enabled",
        "//src/mongo/db/exec:bucket_unpacker",
        "//src/mongo/db/exec:projection_executor",
        "//src/mongo/db/exec:scoped_timer",
        "//src/mongo/db/exec:sort_executor",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/fts:base_fts",
        "//src/mongo/db/index:index_access_method",
        "//src/mongo/db/memory_tracking",
        "//src/mongo/db/pipeline/spilling",
        "//src/mongo/db/query:bucket_predicate_generator",
        "//src/mongo/db/query:query_knobs",
        "//src/mongo/db/query:spill_util",
        "//src/mongo/db/query/client_cursor:cursor_response_idl",
        "//src/mongo/db/query/client_cursor:generic_cursor",
        "//src/mongo/db/query/collation:collator_factory_interface",
        "//src/mongo/db/query/collation:collator_interface",
        "//src/mongo/db/query/compiler/dependency_analysis:dependencies",
        "//src/mongo/db/query/compiler/logical_model/projection:projection_ast",
        "//src/mongo/db/query/compiler/logical_model/sort_pattern",
        "//src/mongo/db/query/compiler/physical_model/query_solution",
        "//src/mongo/db/query/compiler/rewrites:rule_based_rewriter",
        "//src/mongo/db/query/compiler/rewrites/matcher:matcher_rewrites",
        "//src/mongo/db/query/compiler/stats",
        "//src/mongo/db/query/compiler/stats:stats_gen",
        "//src/mongo/db/query/datetime:date_time_support",
        "//src/mongo/db/query/search:mongot_cursor",
        "//src/mongo/db/query/search:mongot_options",
        "//src/mongo/db/query/search:search_index_common",
        "//src/mongo/db/query/search:search_index_process_interface",
        "//src/mongo/db/query/stage_memory_limit_knobs",
        "//src/mongo/db/query/util:query_string_util",
        "//src/mongo/db/query/util:rank_fusion_util",
        "//src/mongo/db/repl:apply_ops_command_info",
        "//src/mongo/db/repl:image_collection_entry",
        "//src/mongo/db/repl:oplog_entry",
        "//src/mongo/db/repl:read_concern_args",
        "//src/mongo/db/repl:repl_coordinator_interface",
        "//src/mongo/db/repl:speculative_majority_read_info",
        "//src/mongo/db/session:logical_session_cache",
        "//src/mongo/db/session:logical_session_id_helpers",
        "//src/mongo/db/session:sessions_collection",
        "//src/mongo/db/shard_role/shard_catalog:collection_catalog",
        "//src/mongo/db/sorter:sorter_base",
        "//src/mongo/db/sorter:sorter_stats",
        "//src/mongo/db/storage:encryption_hooks",
        "//src/mongo/db/storage:index_entry_comparison",
        "//src/mongo/db/storage:storage_options",
        "//src/mongo/db/timeseries:catalog_helper",
        "//src/mongo/db/timeseries:timeseries_conversion_util",
        "//src/mongo/db/timeseries:timeseries_options",
        "//src/mongo/db/update:update_document_diff",
        "//src/mongo/db/views:resolved_view",
        "//src/mongo/executor:task_executor_cursor",
        "//src/mongo/rpc:command_status",
        "//src/mongo/s:analyze_shard_key_common",
        "//src/mongo/s:grid",
        "//src/third_party/snappy",
    ],
)

mongo_cc_library(
    name = "stage_params",
    srcs = [
        "stage_params.cpp",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "lite_parsed_document_source",
    srcs = [
        "lite_parsed_document_source.cpp",
        "lite_parsed_pipeline.cpp",
    ],
    deps = [
        ":aggregation_request_helper",
        ":stage_params",
        "//src/mongo/db/query:common_query_enums_and_helpers",
        "//src/mongo/db/stats:counters",
    ],
)

idl_generator(
    name = "document_source_current_op_gen",
    src = "document_source_current_op.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_densify_gen",
    src = "document_source_densify.idl",
    deps = [
        ":value_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_fill_gen",
    src = "document_source_fill.idl",
    deps = [
        ":value_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_internal_apply_oplog_update_gen",
    src = "document_source_internal_apply_oplog_update.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

mongo_cc_library(
    name = "document_source_internal_apply_oplog_update",
    srcs = [
        "document_source_internal_apply_oplog_update.cpp",
        "//src/mongo/db/exec/agg:internal_apply_oplog_update_stage.cpp",
    ],
    deps = [
        "//src/mongo/db:multitenancy",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/pipeline:sharded_agg_helpers",
        "//src/mongo/db/query/write_ops:write_ops_parsers",
        "//src/mongo/db/update:update_driver",
        "//src/mongo/s/query/exec:router_exec_stage",
    ],
)

idl_generator(
    name = "document_source_internal_projection_gen",
    src = "document_source_internal_projection.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_list_sampled_queries_gen",
    src = "document_source_list_sampled_queries.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/s:analyze_shard_key_documents_gen",
    ],
)

idl_generator(
    name = "document_source_list_sessions_gen",
    src = "document_source_list_sessions.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_lookup_gen",
    src = "document_source_lookup.idl",
    deps = [
        ":aggregate_command_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_merge_gen",
    src = "document_source_merge.idl",
    deps = [
        ":document_source_merge_modes_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db:namespace_spec_gen",
        "//src/mongo/db/versioning_protocol:chunk_version_gen",
    ],
)

idl_generator(
    name = "document_source_merge_modes_gen",
    src = "document_source_merge_modes.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_out_gen",
    src = "document_source_out.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/timeseries:timeseries_gen",
    ],
)

idl_generator(
    name = "document_source_query_settings_gen",
    src = "document_source_query_settings.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_query_stats_gen",
    src = "document_source_query_stats.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/query/query_stats:transform_algorithm_gen",
    ],
)

idl_generator(
    name = "document_source_rank_fusion_gen",
    src = "document_source_rank_fusion.idl",
    deps = [
        ":document_source_rank_fusion_inputs_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_rank_fusion_inputs_gen",
    src = "document_source_rank_fusion_inputs.idl",
    deps = [
        ":aggregate_command_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_replace_root_gen",
    src = "document_source_replace_root.idl",
    deps = [
        ":value_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_score_gen",
    src = "document_source_score.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_score_fusion_gen",
    src = "document_source_score_fusion.idl",
    deps = [
        ":document_source_score_fusion_inputs_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_score_fusion_inputs_gen",
    src = "document_source_score_fusion_inputs.idl",
    deps = [
        ":aggregate_command_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_set_variable_from_subpipeline_gen",
    src = "document_source_set_variable_from_subpipeline.idl",
    deps = [
        ":aggregate_command_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_set_window_fields_gen",
    src = "document_source_set_window_fields.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_union_with_gen",
    src = "document_source_union_with.idl",
    deps = [
        ":aggregate_command_gen",
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "exchange_spec_gen",
    src = "exchange_spec.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "expression_parser_gen",
    src = "expression_parser.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "document_source_list_mql_entities_gen",
    src = "document_source_list_mql_entities.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

mongo_cc_library(
    name = "change_stream_error_extra_info",
    srcs = [
        "change_stream_invalidation_info.cpp",
        "change_stream_start_after_invalidate_info.cpp",
        "change_stream_topology_change_info.cpp",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "variable_validation",
    srcs = [
        "variable_validation.cpp",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "change_stream_pre_and_post_images_options",
    srcs = [
        "change_stream_pre_and_post_images_options_gen",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/idl:idl_parser",
    ],
)

mongo_cc_library(
    name = "docs_needed_bounds",
    srcs = [
        "//src/mongo/db/pipeline/visitors:docs_needed_bounds.cpp",
        "//src/mongo/db/pipeline/visitors:docs_needed_bounds_gen",
        "//src/mongo/db/pipeline/visitors:docs_needed_bounds_util.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/idl:idl_parser",
    ],
)

mongo_cc_library(
    name = "runtime_constants_idl",
    srcs = [
        "legacy_runtime_constants_gen",
    ],
    deps = [
        "//src/mongo/idl:basic_types_serialization",
        "//src/mongo/idl:idl_parser",
    ],
)

mongo_cc_library(
    name = "change_stream_preimage",
    srcs = [
        ":change_stream_preimage_gen",
    ],
    deps = [
        "//src/mongo/db:server_base",
    ],
)

# These interfaces can be used by both mongod and mongos code.
mongo_cc_library(
    name = "change_stream_interfaces",
    srcs = [
        "change_stream.cpp",
        "change_stream_reader_builder.cpp",
        "data_to_shards_allocation_query_service.cpp",
    ],
    deps = [
        "//src/mongo/db:namespace_spec",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:server_base",
        "//src/mongo/db/global_catalog:sharding_catalog_client",
    ],
)

mongo_cc_library(
    name = "change_stream_pipeline",
    srcs = [
        "change_stream_document_diff_parser.cpp",
        "change_stream_event_transform.cpp",
        "change_stream_filter_helpers.cpp",
        "change_stream_pipeline_helpers.cpp",
        "change_stream_rewrite_helpers.cpp",
        "change_stream_split_event_helpers.cpp",
        "document_source_change_stream.cpp",
        "document_source_change_stream_add_post_image.cpp",
        "document_source_change_stream_add_pre_image.cpp",
        "document_source_change_stream_check_invalidate.cpp",
        "document_source_change_stream_check_resumability.cpp",
        "document_source_change_stream_check_topology_change.cpp",
        "document_source_change_stream_ensure_resume_token_present.cpp",
        "document_source_change_stream_handle_topology_change.cpp",
        "document_source_change_stream_handle_topology_change_v2.cpp",
        "document_source_change_stream_inject_control_events.cpp",
        "document_source_change_stream_oplog_match.cpp",
        "document_source_change_stream_split_large_event.cpp",
        "document_source_change_stream_transform.cpp",
        "document_source_change_stream_unwind_transaction.cpp",
        "//src/mongo/db/exec/agg:change_stream_add_post_image_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_add_pre_image_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_check_invalidate_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_check_resumability_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_check_topology_change_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_ensure_resume_token_present_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_handle_topology_change_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_handle_topology_change_v2_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_inject_control_events_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_split_large_event_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_transform_stage.cpp",
        "//src/mongo/db/exec/agg:change_stream_unwind_transaction_stage.cpp",
        "//src/mongo/db/pipeline/optimization:change_stream_rules.cpp",
    ],
    deps = [
        ":change_stream_helpers",
        ":change_stream_interfaces",
        ":change_stream_preimage",
        ":change_stream_topology_helpers",
        "//src/mongo/db:multitenancy",
        "//src/mongo/db:server_feature_flags",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/pipeline:sharded_agg_helpers",
        "//src/mongo/db/query/write_ops:write_ops_parsers",
        "//src/mongo/db/update:update_driver",
        "//src/mongo/s/change_streams",
        "//src/mongo/s/query/exec:router_exec_stage",
        "//src/mongo/util:pcre_util",
    ],
)

mongo_cc_library(
    name = "sharded_agg_helpers",
    srcs = [
        "sharded_agg_helpers.cpp",
        "split_pipeline.cpp",
    ],
    deps = [
        ":aggregation",
        "//src/mongo/db:shard_role_api",
        "//src/mongo/s:async_requests_sender",
        "//src/mongo/s:sharding_router_api",
        "//src/mongo/s/query:cluster_query_knobs",
        "//src/mongo/s/query/exec:cluster_cursor",
    ],
)

mongo_cc_library(
    name = "pipeline_visitor",
    srcs = [
        "//src/mongo/db/pipeline/visitors:document_source_walker.cpp",
    ],
    deps = [
        ":pipeline",
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "docs_needed_bounds_visitor",
    srcs = [
        "//src/mongo/db/pipeline/visitors:document_source_visitor_docs_needed_bounds.cpp",
    ],
    deps = [
        ":change_stream_pipeline",
        ":docs_needed_bounds",
        ":document_source_internal_apply_oplog_update",
        ":pipeline",
        ":pipeline_visitor",
    ],
)

mongo_cc_library(
    name = "change_stream_expired_pre_image_remover",
    srcs = [
        "change_stream_expired_pre_image_remover.cpp",
    ],
    deps = [
        "//src/mongo/db:change_stream_pre_images_collection_manager",
        "//src/mongo/db/repl:replica_set_aware_service",
        "//src/mongo/db/shard_role",
        "//src/mongo/util:periodic_runner",
    ],
)

mongo_cc_library(
    name = "expression_context_for_test",
    deps = [
        "//src/mongo/db/query:query_test_service_context",
    ],
)

mongo_cc_unit_test(
    name = "db_percentile_algo_test",
    srcs = [
        "percentile_algo_continuous_test.cpp",
        "percentile_algo_discrete_test.cpp",
        "percentile_algo_tdigest_distributed_test.cpp",
        "percentile_algo_tdigest_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":accumulator",
        ":expression_context_for_test",
    ],
)

mongo_cc_unit_test(
    name = "common_sort_key_optimization_test",
    srcs = [
        "common_sort_key_optimization_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":accumulator",
        ":aggregation_context_fixture",
        ":pipeline",
        "//src/mongo/db/query:query_test_service_context",
    ],
)

mongo_cc_library(
    name = "document_source_mock",
    srcs = [
        "document_source_mock.cpp",
        "//src/mongo/db/exec/agg:mock_stage.cpp",
        "//src/mongo/db/pipeline/process_interface:stub_lookup_single_document_process_interface.cpp",
    ],
    deps = [
        ":expression_context_for_test",
        ":pipeline",
        "//src/mongo/db/query:query_test_service_context",
    ],
)

mongo_cc_unit_test(
    name = "db_pipeline_test",
    srcs = [
        "accumulator_test.cpp",
        "aggregation_request_test.cpp",
        "change_stream_document_diff_parser_test.cpp",
        "change_stream_event_transform_test.cpp",
        "change_stream_reader_builder_test.cpp",
        "change_stream_rewrites_test.cpp",
        "change_stream_shard_targeter_test.cpp",
        "change_stream_split_event_helpers_test.cpp",
        "change_stream_stage_test_fixture.cpp",
        "change_stream_test.cpp",
        "data_to_shards_allocation_query_service_test.cpp",
        "dependencies_test.cpp",
        "desugarer_test.cpp",
        "dispatch_shard_pipeline_test.cpp",
        "document_path_support_test.cpp",
        "document_source_add_fields_test.cpp",
        "document_source_bucket_auto_test.cpp",
        "document_source_bucket_test.cpp",
        "document_source_change_stream_add_post_image_test.cpp",
        "document_source_change_stream_handle_topology_change_v2_test.cpp",
        "document_source_change_stream_test.cpp",
        "document_source_check_resume_token_test.cpp",
        "document_source_count_test.cpp",
        "document_source_current_op_test.cpp",
        "document_source_densify_test.cpp",
        "document_source_documents_test.cpp",
        "document_source_exchange_test.cpp",
        "document_source_facet_test.cpp",
        "document_source_fill_test.cpp",
        "document_source_find_and_modify_image_lookup_test.cpp",
        "document_source_geo_near_test.cpp",
        "document_source_graph_lookup_test.cpp",
        "document_source_group_test.cpp",
        "document_source_hybrid_scoring_util_test.cpp",
        "document_source_internal_apply_oplog_update_test.cpp",
        "document_source_internal_compute_geo_near_distance_test.cpp",
        "document_source_internal_convert_bucket_index_stats_test.cpp",
        "document_source_internal_split_pipeline_test.cpp",
        "document_source_limit_test.cpp",
        "document_source_list_extensions_test.cpp",
        "document_source_list_mql_entities_test.cpp",
        "document_source_lookup_test.cpp",
        "document_source_match_test.cpp",
        "document_source_merge_test.cpp",
        "document_source_mock_test.cpp",
        "document_source_out_test.cpp",
        "document_source_plan_cache_stats_test.cpp",
        "document_source_project_test.cpp",
        "document_source_query_stats_test.cpp",
        "document_source_queue_test.cpp",
        "document_source_rank_fusion_test.cpp",
        "document_source_redact_test.cpp",
        "document_source_replace_root_test.cpp",
        "document_source_sample_test.cpp",
        "document_source_score_fusion_test.cpp",
        "document_source_score_test.cpp",
        "document_source_sequential_document_cache_test.cpp",
        "document_source_set_metadata_test.cpp",
        "document_source_set_variable_from_subpipeline_test.cpp",
        "document_source_set_window_fields_test.cpp",
        "document_source_skip_test.cpp",
        "document_source_sort_by_count_test.cpp",
        "document_source_sort_test.cpp",
        "document_source_test.cpp",
        "document_source_union_with_test.cpp",
        "document_source_unwind_test.cpp",
        "expression_and_test.cpp",
        "expression_clone_test.cpp",
        "expression_compare_test.cpp",
        "expression_context_test.cpp",
        "expression_convert_test.cpp",
        "expression_create_oid_test.cpp",
        "expression_create_uuid_test.cpp",
        "expression_date_test.cpp",
        "expression_field_path_test.cpp",
        "expression_find_internal_test.cpp",
        "expression_function_test.cpp",
        "expression_hasher_test.cpp",
        "expression_let_test.cpp",
        "expression_map_reduce_filter_test.cpp",
        "expression_nary_test.cpp",
        "expression_object_test.cpp",
        "expression_or_test.cpp",
        "expression_replace_test.cpp",
        "expression_subtype_test.cpp",
        "expression_test.cpp",
        "expression_test_api_version_test.cpp",
        "expression_test_feature_flags_test.cpp",
        "expression_trim_test.cpp",
        "expression_vector_similarity_test.cpp",
        "expression_walker_test.cpp",
        "field_path_test.cpp",
        "granularity_rounder_powers_of_two_test.cpp",
        "granularity_rounder_preferred_numbers_test.cpp",
        "lite_parsed_document_source_test.cpp",
        "lookup_set_cache_test.cpp",
        "monotonic_expression_test.cpp",
        "partition_key_comparator_test.cpp",
        "pipeline_metadata_tree_test.cpp",
        "pipeline_test.cpp",
        "plan_executor_pipeline_test.cpp",
        "resume_token_test.cpp",
        "semantic_analysis_test.cpp",
        "sequential_document_cache_test.cpp",
        "serverless_aggregation_context_fixture.cpp",
        "sharded_agg_helpers_test.cpp",
        "sharded_union_test.cpp",
        "skip_and_limit_test.cpp",
        "stage_params_to_document_source_registry_test.cpp",
        "tee_buffer_test.cpp",
        "//src/mongo/db/exec/agg:document_source_to_stage_registry_test.cpp",
        "//src/mongo/db/extension/host:document_source_extension_expandable_test.cpp",
        "//src/mongo/db/extension/host:document_source_extension_optimizable_test.cpp",
        "//src/mongo/db/extension/host:document_source_extension_test.cpp",
        "//src/mongo/db/pipeline:document_source_coll_stats_test.cpp",
        "//src/mongo/db/pipeline:document_source_internal_all_collection_stats_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:create_predicates_on_bucket_level_field_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:extract_or_build_project_to_internalize_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:extract_project_for_pushdown_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:group_reorder_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:internalize_project_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:limit_reorder_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:match_fixed_buckets_reorder_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:optimize_lastpoint_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:optimize_pipeline_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:pushdown_computed_meta_projections_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:sample_reorder_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:sort_reorder_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:split_match_on_meta_and_rename_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:top_k_sort_optimization_test.cpp",
        "//src/mongo/db/pipeline/document_source_internal_unpack_bucket_test:unpack_bucket_exec_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_internal_search_id_lookup_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_internal_search_mongot_remote_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_list_search_indexes_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_search_meta_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_search_test.cpp",
        "//src/mongo/db/pipeline/search:document_source_vector_search_test.cpp",
        "//src/mongo/db/pipeline/visitors:docs_needed_bounds_test.cpp",
        "//src/mongo/db/pipeline/visitors:document_source_visitor_docs_needed_bounds_test.cpp",
        "//src/mongo/db/pipeline/visitors:document_source_walker_test.cpp",
        "//src/mongo/db/pipeline/window_function:partition_iterator_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_add_to_set_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_avg_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_concat_arrays_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_covariance_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_derivative_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_first_last_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_min_max_scaler_non_removable_range_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_min_max_scaler_non_removable_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_non_removable_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_exec_removable_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_integral_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_min_max_scaler_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_min_max_scaler_util_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_min_max_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_n_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_push_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_set_union_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_std_dev_test.cpp",
        "//src/mongo/db/pipeline/window_function:window_function_sum_test.cpp",
        "//src/mongo/s/query/exec:document_source_merge_cursors_test.cpp",
    ],
    minimum_test_resources = {
        "cpu_cores": 2,
    },
    srcs_select = [{
        "//bazel/config:js_engine_mozjs": [
            "accumulator_js_test.cpp",
            "expression_javascript_test.cpp",
        ],
        "//bazel/config:js_engine_none": [
        ],
    }],
    tags = [
        # Trying to access /data/db/ is incompatible with the sandbox
        "code_coverage_quarantine",
        "code_coverage_quarantine_SERVER-98846",
        "mongo_unittest_seventh_group",
    ],
    deps = [
        ":accumulator",
        ":aggregation_context_fixture",
        ":aggregation_request_helper",
        ":change_stream_pipeline",
        ":change_stream_preimage",
        ":change_stream_test_helpers",
        ":docs_needed_bounds_visitor",
        ":document_source_internal_apply_oplog_update",
        ":document_source_mock",
        ":document_sources_idl",
        ":expression_context_for_test",
        ":field_path",
        ":granularity_rounder",
        ":pipeline",
        ":pipeline_visitor",
        ":sharded_agg_helpers",
        ":stage_params",
        "//src/mongo:base",
        "//src/mongo/db:change_stream_options",
        "//src/mongo/db:change_stream_options_manager",
        "//src/mongo/db:change_stream_pre_image_util",
        "//src/mongo/db:change_stream_pre_images_collection_manager",
        "//src/mongo/db:mongohasher",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/auth:authmocks",
        "//src/mongo/db/collection_crud",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/exec/document_value:document_value_test_util",
        "//src/mongo/db/extension/host:extension_loader",
        "//src/mongo/db/extension/sdk:sdk_cpp",
        "//src/mongo/db/op_observer",
        "//src/mongo/db/op_observer:op_observer_impl",
        "//src/mongo/db/op_observer:operation_logger_impl",
        "//src/mongo/db/pipeline:change_stream_expired_pre_image_remover",
        "//src/mongo/db/pipeline/process_interface:mongod_process_interfaces",
        "//src/mongo/db/pipeline/process_interface:mongos_process_interface",
        "//src/mongo/db/pipeline/process_interface:shardsvr_process_interface",
        "//src/mongo/db/pipeline/spilling:spilling_test_utils",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/query/collation:collator_interface_mock",
        "//src/mongo/db/query/search:mongot_cursor",
        "//src/mongo/db/query/search:mongot_options",
        "//src/mongo/db/repl:image_collection_entry",
        "//src/mongo/db/repl:oplog_entry",
        "//src/mongo/db/repl:replmocks",
        "//src/mongo/db/repl:storage_interface_impl",
        "//src/mongo/db/shard_role/shard_catalog:catalog_test_fixture",
        "//src/mongo/db/sharding_environment:shard_server_test_fixture",
        "//src/mongo/db/sharding_environment:sharding_mongos_test_fixture",
        "//src/mongo/db/storage/devnull:storage_devnull_core",
        "//src/mongo/executor:thread_pool_task_executor_test_fixture",
        "//src/mongo/s/query/exec:router_exec_stage",
        "//src/mongo/unittest",
        "//src/mongo/util:clock_source_mock",
        "//src/mongo/util:version_impl",
    ],
)

mongo_cc_library(
    name = "aggregation_context_fixture",
    deps = [
        ":expression_context_for_test",
        ":pipeline",
    ],
)

mongo_cc_unit_test(
    name = "group_with_acc_n_optimization_test",
    srcs = [
        "group_with_acc_n_optimization_test.cpp",
    ],
    tags = ["mongo_unittest_sixth_group"],
    deps = [
        ":accumulator",
        ":aggregation_context_fixture",
        ":pipeline",
        "//src/mongo/db/query:query_test_service_context",
    ],
)

mongo_cc_unit_test(
    name = "initialize_auto_get_helper_test",
    srcs = [
        "initialize_auto_get_helper_test.cpp",
    ],
    private_hdrs = [
        "initialize_auto_get_helper.h",
    ],
    tags = ["mongo_unittest_eighth_group"],
    deps = [
        "//src/mongo/db:shard_role_api",
        "//src/mongo/db/s:sharding_runtime_d",
        "//src/mongo/db/sharding_environment:shard_server_test_fixture",
        "//src/mongo/s:sharding_router_api",
    ],
)

mongo_cc_benchmark(
    name = "pipeline_optimization_bm",
    srcs = [
        "pipeline_optimization_bm.cpp",
    ],
    tags = ["query_bm"],
    deps = [
        ":expression_context_for_test",
        ":pipeline",
        "//src/mongo/db/query:query_fcv_environment_for_test",
    ],
)

mongo_cc_benchmark(
    name = "document_source_group_bm",
    srcs = [
        "document_source_group_bm.cpp",
    ],
    tags = ["second_half_bm"],
    deps = [
        ":aggregation_context_fixture",
        ":document_source_mock",
        ":pipeline",
        "//src/mongo/db:service_context_test_fixture",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/shard_role:service_context_non_d",
    ],
)

mongo_cc_benchmark(
    name = "percentile_algo_bm",
    srcs = ["percentile_algo_bm_fixture.cpp"],
    tags = ["query_bm"],
    deps = [
        ":accumulator",
        ":expression_context_for_test",
        "//src/mongo/db/query:query_fcv_environment_for_test",
    ],
)

mongo_cc_benchmark(
    name = "window_function_percentile_bm",
    srcs = ["//src/mongo/db/pipeline/window_function:window_function_percentile_bm_fixture.cpp"],
    tags = ["query_bm"],
    deps = [
        ":accumulator",
        ":expression_context_for_test",
        "//src/mongo/db/query:query_fcv_environment_for_test",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/shard_role:service_context_non_d",
    ],
)

mongo_cc_benchmark(
    name = "window_function_concat_arrays_bm",
    srcs = ["//src/mongo/db/pipeline/window_function:window_function_concat_arrays_bm_fixture.cpp"],
    tags = ["query_bm"],
    deps = [
        ":accumulator",
        ":expression_context_for_test",
        "//src/mongo/db/query:query_fcv_environment_for_test",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/shard_role:service_context_non_d",
    ],
)

mongo_cc_benchmark(
    name = "window_function_add_to_set_bm",
    srcs = [
        "//src/mongo/db/pipeline/window_function:window_function_add_to_set_bm.cpp",
    ],
    tags = ["query_bm"],
    deps = [
        ":expression_context_for_test",
    ],
)

mongo_cc_benchmark(
    name = "expression_clone_bm",
    srcs = [
        "expression_clone_bm.cpp",
    ],
    tags = ["query_bm"],
    deps = [
        ":expression_context_for_test",
        "//src/mongo/db/exec:expression_bm_fixture",
    ],
)

idl_generator(
    name = "document_source_coll_stats_gen",
    src = "document_source_coll_stats.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/pipeline:storage_stats_spec_gen",
    ],
)

idl_generator(
    name = "document_source_internal_all_collection_stats_gen",
    src = "document_source_internal_all_collection_stats.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/pipeline:document_source_coll_stats_gen",
        "//src/mongo/db/pipeline:storage_stats_spec_gen",
    ],
)

idl_generator(
    name = "document_source_list_cluster_catalog_gen",
    src = "document_source_list_cluster_catalog.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

mongo_cc_library(
    name = "desugarer",
    srcs = ["desugarer.cpp"],
    hdrs = ["desugarer.h"],
    visibility = ["//visibility:public"],
    deps = [
        "//src/mongo/db/pipeline",
    ],
)
